package com.example.wordpress;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.view.View;
import android.webkit.WebView;

/**
 * Vista WebActivity
 * @author Ignacio Javier Kovacs
 *
 */

public class WebActivityView extends View
{
	private final Activity webActivity;
	private final WebView webView;
	private ProgressDialog pDialog;
	
	public WebActivityView(Context context)
	{
		super(context);
		webActivity = (Activity) context;
		webActivity.setContentView(R.layout.activity_web);
		
		webView = (WebView) webActivity.findViewById(R.id.webView);
		pDialog = createProgressDialog();
	}
	
	public Activity getActivity() {
		return webActivity;
	}
	
	public WebView getWebView() {
		return webView;
	}
	
	private ProgressDialog createProgressDialog() {
		ProgressDialog pd = new ProgressDialog(webActivity);
		pd.setTitle("Processing...");
		pd.setMessage("Please wait.");
		pd.setCancelable(false);
		pd.setIndeterminate(true);
		pd.hide();
		return pd;
	}
	
	public void showProgressDialog() {
		pDialog.show();
	}
	
	public void hideProgressDialog() {
		pDialog.hide();
	}
	
	public void dismissProgressDialog() {
		pDialog.dismiss();
	}
}
